import matplotlib.pyplot as plt
import pandas as pd
plt.rcParams['font.sans-serif']='SimHei'
df=pd.read_excel('学生各学期成绩表.xlsx',index_col=0)
data=df.agg('mean',numeric_only=True)
print(data)
plt.pie(data,labels=data.index,autopct='%.2f%%')

plt.title('各学期学生成绩饼状图')
plt.show()